package com.jason.system.config;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import springfox.documentation.builders.ApiInfoBuilder;
import springfox.documentation.builders.PathSelectors;
import springfox.documentation.builders.RequestHandlerSelectors;
import springfox.documentation.service.Contact;
import springfox.documentation.spi.DocumentationType;
import springfox.documentation.spring.web.plugins.Docket;
import springfox.documentation.swagger2.annotations.EnableSwagger2;

/**
 * @author jie
 * @version 1.0
 * success come from self-discipline
 * @date 2021/3/19 12:05
 */

@Configuration
@EnableSwagger2
public class SwaggerConfig {

    @Bean
    public Docket createRestApi(){
      return new Docket(DocumentationType.SWAGGER_2)
                .apiInfo(new ApiInfoBuilder()
                        .title("business-system")
                        .description("基于swagger构建的REST API接口详细信息")
                        .termsOfServiceUrl("https://gitee.com/jie958654064/business-system")
                        .contact(new Contact("jasonj","https://github.com/jasonj1102","jie958654064@gmail.com"))
                        .version("9.0")
                        .build()
                )
                .pathMapping("/")
                .select()
                .apis(RequestHandlerSelectors.basePackage("com.jason.system.controller"))
                .paths(PathSelectors.any())
                .build();
    }
}
